<template>
    <div class="safe_view">
        <list v-if="list.length" :list="list"></list>
        <div class="tip" v-else>
            没有您要搜索的内容 <a href="#" @click="$router.back()">返回</a>
        </div>
    </div>
</template>
<script>
import $ajax from "../plugins/ajax";
export default {
    beforeRouteEnter:async (to,from,next)=>{
        var res=await $ajax("/search?word="+to.query.word);
        next(vm=>{
            vm.list=res.data;
        })
    },
    beforeRouteUpdate:async function(to,from,next){
        var res=await $ajax("/search?word="+to.query.word);
        // console.log(this);
        this.list=res.data;
        next();
    },
    data(){
        return{
            list:[]
        }
    }
}
</script>
<style scoped>
    .tip{
        line-height: 500px;
        text-align: center;
    }
</style>